# import torch
# x = torch.tensor(3.5, requires_grad=True)#自动微分
# print(x)
# y = (x-1) * (x-2) * (x-3)

# print(y)#tensor(1.8750, grad_fn=<MulBackward0>)记住公式，y是如何来的
import torch
x = torch.tensor(3.5, requires_grad=True)

y = x*x

z = 2*y + 3

z.backward()

print(x.grad)
